import { ref,onMounted, Ref, onBeforeUnmount } from 'vue'
import DeviceUtil from '~/utils/DeviceUtil';
export default class VueHeaderXMain {

    static that:VueHeaderXMain

    static Tag:string = "VueHeaderXMain"

    isCollapse:Ref<boolean> = ref(false)

    menus:Ref<any> = ref([
        {icon:"el-icon-menu", name: "主页", path: "/"},
        {icon:"el-icon-menu", name: "动画/切图/动态文本", path: "/process"},
        {icon:"el-icon-menu", name: "树管理", path: "/tree"},
    ])

    constructor(){

        VueHeaderXMain.that = this

        onMounted(()=>{
            window.onresize = ()=>{
                let statusT = DeviceUtil.getFullScreenStatus()
                if(!statusT)
                    this.isCollapse.value = false
            }
        })

        onBeforeUnmount(()=>{
            window.onresize = null
        })

    }

    collapseMenu(){
        let isChange = DeviceUtil.fullScreen() 
        if(isChange!=null)
            this.isCollapse.value = !isChange
    }

}